package com.spring.aop.config;

import org.aspectj.lang.annotation.*;

@Aspect
public class LogAspects {

    @Pointcut("execution(public int com.spring.aop.controller.MathCalculator.*(..))")
    public void pointCut() {

    }

    @Before("execution(public int com.spring.aop.controller.MathCalculator.*(..))")
    public void logStart() {
        System.out.println("除法开始...参数列表是{}");
    }

    @After("com.spring.aop.config.LogAspects.pointCut()")
    public void logEnd() {
        System.out.println("除法结束...");
    }

    @AfterReturning("com.spring.aop.config.LogAspects.pointCut()")
    public void logReturn() {
        System.out.println("正常返回...运行结果{}");
    }

    @AfterThrowing("com.spring.aop.config.LogAspects.pointCut()")
    public void logException() {
        System.out.println("出现异常...异常信息.{}");
    }
}
